package choice;
import java.util.Scanner;
public class switchdemo2{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入1~7之间的数字:");
        int weekDay = scan.nextInt();
        switch (weekDay) {
            /**   相当于:
             *      case 1: //如果weekDay==1
             System.out.println("星期一"); //如果满足case 1, 而case 1后面没有break; 将继续向下执行而且不再判断case
             break; //一旦输出"星期一" 立马结束switch
             */
            case 1 -> System.out.println("星期一");
            case 2 -> System.out.println("星期二");
            case 3 -> System.out.println("星期三");
            case 4 -> System.out.println("星期四");
            case 5 -> System.out.println("星期五");
            case 6 -> System.out.println("星期六");
            case 7 -> System.out.println("星期七");
            default -> System.out.println("请输入1~7之间的数字");
        }
    }
}